package com.yt.system.service.impl;

import com.yt.system.dao.AccountMapper;
import com.yt.system.dao.HistoryMapper;
import com.yt.system.domain.Account;
import com.yt.system.domain.History;
import com.yt.system.domain.WeekScore;
import com.yt.system.service.HistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * ShiYuNan
 */
@Service
public class HistoryServiceImpl implements HistoryService {

    @Autowired
    HistoryMapper historyMapper;
    @Autowired
    AccountMapper accountMapper;
    @Override
    public int insert(History record) {
        return historyMapper.insert(record);
    }

    @Override
    public List<History> selectByAid(Integer aid) {
        return historyMapper.selectByAid(aid);
    }

    @Override
    public List<History> selectAllHistory() {
        return historyMapper.selectAllHistory();
    }

    /**
     * 根据用户ID查询个人积分
     * @param aid
     * @return
     */
    @Override
    public Double selectScoreByAid(Integer aid) {
        return accountMapper.selectByPrimaryKey(aid).getAintegral();
    }

    /**
     * 根据用户ID更新用户的积分
     * @param record
     * @return
     */
    @Override
    public int updateByPrimaryKeySelective(Account record) {
        return accountMapper.updateByPrimaryKeySelective(record);
    }
    /**
     * 根据操作时间查询历史积分记录
     * @param map
     * @return
     */
    @Override
    public List<History> selectByTime(Map map) {
        return historyMapper.selectByTime(map);
    }







}
